import ajax from "@/utils/request";

// 获取SPU分页列表的数据
export const reqSpuList = (page = 1, limit = 5, category3Id) =>
  ajax.get(`/admin/product/${page}/${limit}`, {
    params: {
      category3Id,
    },
  });

// 获取SPU分页列表的数据
export const reqBaseSaleAttrList = () =>
  ajax.get(`/admin/product/baseSaleAttrList`);

// 获取所有的品牌列表
export const reqTrademarkList = () =>
  ajax.get(`/admin/product/baseTrademark/getTrademarkList`);

// 添加SPU
export const reqAddSpu = (data) =>
  ajax.post(`/admin/product/saveSpuInfo`, data);
// 修改SPU
export const reqEditSpu = (data) =>
  ajax.post(`/admin/product/updateSpuInfo`, data);

// 获取SPU的销售属性
export const reqSpuSaleAttrList = (id) =>
  ajax.get(`/admin/product/spuSaleAttrList/${id}`);

// 获取SPU的图片列表
export const reqSpuImageList = (id) =>
  ajax.get(`/admin/product/spuImageList/${id}`);

// 删除SPU
export const reqDeleteSpu = (category3Id, id) =>
  ajax.delete(`/admin/product/deleteSpu/${id}`, {
    params: {
      category3Id,
    },
  });
